package com.example.ball.Controller;

import com.example.ball.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/checklogin", method = {RequestMethod.POST})
    public int checkLogin(@RequestParam("username") String username, @RequestParam("password") String password){
        return userService.checkLogin(username, password) ? 1 : 0;
    }
}
